// 计算属性，在项目中是为了简化数据而生
const getters={
  // 这里的state形参,是当前小仓库的state
  goodsList(state){
    // 如果网络不给力或者没网,会返回undefined,undefined无法v-for遍历,因此要短路运算,至少给个空数组
    return state.search.getList.goodsList||[]
  },
  trademarkList: (state)=>state.search.getList.trademarkList,
  attrsList: (state)=>state.search.getList.attrsList,
  categoryView: (state)=>state.detail.goodinfo.categoryView||{},
  skuInfo: (state)=>state.detail.goodinfo.skuInfo||{}, // 简化产品信息
  spuSaleAttrList: (state)=>state.detail.goodinfo.spuSaleAttrList||[], // 简化产品售卖属性
  cartList: state=>state.cart.getCartList[0]||{}
}
export default getters